import Vue from 'vue';
import VuePicker from './picker.vue';

const Picker = Vue.extend(VuePicker);
/**
 * picker - options
 * 
 * @param type 类型：selector普通选择器 region：地区选择器 date日期时间选择器
 * @param selectorType 类型
 * @param selectorValues 数据源
 * @param regionLevel 区域等级 1 2 3
 * @param dateMode 日期模式 none after before
 * @param dateType 日期类型 none date time year month day hour minute second date-year date-month date-day time-hour time-minute time-second
 * @param defaultValue 默认值
 * @param confirmFunction 确定回调 
 * @param cancelFunction 取消回调
 */
const picker = (options) => {
    // 实例
    const instance = new Picker();
    instance.vm = instance.$mount();
    document.body.appendChild(instance.vm.$el);
    // 赋值
    instance.type = options.type;
    instance.selectorType = options.selectorType;
    instance.selectorValues = options.selectorValues;
    instance.regionLevel = options.regionLevel;
    instance.dateMode = options.dateMode;
    instance.dateType = options.dateType;
    instance.defaultValue = options.defaultValue;
    instance.confirmFunction = options.confirmFunction;
    instance.cancelFunction = options.cancelFunction;
}
export default picker